#include "processBar.h"

char bar[101] = { 0 };
int size = 0;
const char* cy = "|/-\\";

void BarInit()
{
  memset(bar, '\0', sizeof(bar)); 
}

void ProcessBar(int rate)
{
  if(rate < 0 || rate > 100) {
    return;
  }
  while(size != rate) {
    bar[size++] = '#';
  }
  printf("[%-100s][%d%%][%c]\r", bar, rate, cy[rate % 4]);
  fflush(stdout);
}
